﻿using System;
using System.IO;

namespace DiverseStudents
{
    public static class DConfig
    {
        public static string loadPath;
        public static string savePath;
        public static bool logPrint;
        static bool hasSavePath;
        static bool hasLoadPath = false;
        public static bool CheckPath(string path)
        {
            if (path.Length > 0)
            {
                if (Directory.Exists(path))
                {
                    return true;
                }
                else
                {
                    try
                    {
                        Directory.CreateDirectory(path);
                    }
                    catch (Exception e)
                    {

                        DLog.Error(e);
                        return false;
                    }
                    return true;
                }
            }
            return false;
        }

        public static bool CheckLoadPath()
        {
            if (!hasLoadPath)
            {
               hasLoadPath =  CheckPath(loadPath);
            }
            return hasLoadPath;
        }

        public static bool CheckSavePath()
        {
            if (!hasSavePath)
            {
                hasSavePath = CheckPath(savePath);
            }
            return hasSavePath;
        }
    }
}
